package com.sk.cardeal.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.cardeal.R;
import com.sk.cardeal.entity.NewPartsList;

import java.util.List;

/**
 * Created by sk on 2018/4/4.
 */

public class BottomDataAdapter extends BaseQuickAdapter<NewPartsList.ResultListBean.PartsQualityListBean,BaseViewHolder> {

    public BottomDataAdapter(int layoutResId, @Nullable List<NewPartsList.ResultListBean.PartsQualityListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NewPartsList.ResultListBean.PartsQualityListBean item) {
        String qs = "";
        switch (item.getQuality()){
            case 1:
                qs = "原厂件";
                break;
            case 2:
                qs = "品牌件";
                break;
            case 3:
                qs = "改装件";
                break;
            case 4:
                qs = "自制件";
                break;
            case 5:
                qs = "修复件";
                break;
            case 6:
                qs = "拆车件";
                break;
        }
        helper.setText(R.id.tv_name,item.getPartsName())
        .setText(R.id.tv_type,qs)
        .setText(R.id.tv_stock,"库存:"+item.getCount())
        .setText(R.id.edit_num,item.getWantCount()+"")
        .addOnClickListener(R.id.add)
        .addOnClickListener(R.id.reduce);
    }
}
